package b.g.b.h;

import b.g.b.b;
import b.g.b.d;
import b.g.b.g;
import b.g.b.h.d.a;

/* compiled from: Guideline */
public class f extends d {
    public float l0 = -1.0f;
    public int m0 = -1;
    public int n0 = -1;
    public c o0 = this.E;
    public int p0;
    public boolean q0;

    public f() {
        int i = 0;
        this.p0 = 0;
        this.M.clear();
        this.M.add(this.o0);
        int length = this.L.length;
        while (i < length) {
            this.L[i] = this.o0;
            i++;
        }
    }

    public boolean A() {
        return this.q0;
    }

    public void O(d dVar, boolean z) {
        if (this.P != null) {
            int o = dVar.o(this.o0);
            if (this.p0 == 1) {
                this.U = o;
                this.V = 0;
                H(this.P.l());
                M(0);
            } else {
                this.U = 0;
                this.V = o;
                M(this.P.r());
                H(0);
            }
        }
    }

    public void P(int i) {
        c cVar = this.o0;
        cVar.b = i;
        cVar.c = true;
        this.q0 = true;
    }

    public void Q(int i) {
        if (this.p0 != i) {
            this.p0 = i;
            this.M.clear();
            if (this.p0 == 1) {
                this.o0 = this.D;
            } else {
                this.o0 = this.E;
            }
            this.M.add(this.o0);
            i = this.L.length;
            for (int i2 = 0; i2 < i; i2++) {
                this.L[i2] = this.o0;
            }
        }
    }

    public void d(d dVar, boolean z) {
        a aVar = a.WRAP_CONTENT;
        e eVar = (e) this.P;
        if (eVar != null) {
            g l;
            g l2;
            Object i = eVar.i(c.a.LEFT);
            Object i2 = eVar.i(c.a.RIGHT);
            d dVar2 = this.P;
            int i3 = 1;
            int i4 = (dVar2 == null || dVar2.O[0] != aVar) ? 0 : 1;
            if (this.p0 == 0) {
                i = eVar.i(c.a.TOP);
                i2 = eVar.i(c.a.BOTTOM);
                d dVar3 = this.P;
                if (dVar3 == null || dVar3.O[1] != aVar) {
                    i3 = 0;
                }
                i4 = i3;
            }
            if (this.q0) {
                c cVar = this.o0;
                if (cVar.c) {
                    l = dVar.l(cVar);
                    dVar.e(l, this.o0.c());
                    if (this.m0 != -1) {
                        if (i4 != 0) {
                            dVar.f(dVar.l(i2), l, 0, 5);
                        }
                    } else if (!(this.n0 == -1 || i4 == 0)) {
                        l2 = dVar.l(i2);
                        dVar.f(l, dVar.l(i), 0, 5);
                        dVar.f(l2, l, 0, 5);
                    }
                    this.q0 = false;
                    return;
                }
            }
            if (this.m0 != -1) {
                l = dVar.l(this.o0);
                dVar.d(l, dVar.l(i), this.m0, 8);
                if (i4 != 0) {
                    dVar.f(dVar.l(i2), l, 0, 5);
                }
            } else if (this.n0 != -1) {
                l = dVar.l(this.o0);
                l2 = dVar.l(i2);
                dVar.d(l, l2, -this.n0, 8);
                if (i4 != 0) {
                    dVar.f(l, dVar.l(i), 0, 5);
                    dVar.f(l2, l, 0, 5);
                }
            } else if (this.l0 != -1.0f) {
                l = dVar.l(this.o0);
                g l3 = dVar.l(i2);
                float f = this.l0;
                b m = dVar.m();
                m.d.g(l, -1.0f);
                m.d.g(l3, f);
                dVar.c(m);
            }
        }
    }

    public boolean e() {
        return true;
    }

    public c i(c.a aVar) {
        switch (aVar.ordinal()) {
            case 0:
            case 5:
            case 6:
            case 7:
            case 8:
                return null;
            case 1:
            case 3:
                if (this.p0 == 1) {
                    return this.o0;
                }
                break;
            case 2:
            case 4:
                if (this.p0 == 0) {
                    return this.o0;
                }
                break;
        }
        throw new AssertionError(aVar.name());
    }

    public boolean z() {
        return this.q0;
    }
}
